package com.superdry.global;

import java.util.LinkedList;
import java.util.List;

import com.superdry.utils.SPHelper;

import android.app.Activity;
import android.app.Application;

public class SApplication extends Application {

	private List activity_list = new LinkedList();
	private static SApplication instance;

	private SApplication() {
	}

	// 单例模式中获取唯一的ExitApplication实例
	public static SApplication getInstance() {
		if (null == instance) {
			instance = new SApplication();
		}
		return instance;
	}

	// 添加Activity到容器中
	public void addActivity(Activity activity) {
		activity_list.add(activity);
	}

	// 遍历所有Activity并finish
	public void exit() {
		for(int i = 0 ; i < activity_list.size();i++){
			((Activity) activity_list.get(i)).finish();
		}
		System.exit(0);
	}
	
}
